<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="author" content="wangbo">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>BOM</title>
</head>
<body>
  <button onclick="myforward()">向前</button>
  <button onclick="myback()">向后</button>

   <button onclick="mygo(1)">向前1</button>
  <button onclick="mygo(-1)">向后-1</button>
   <!-- location 网址 -->
  <script>
    // 浏览器的历史记录
    let fn1 = () => {
      // 浏览器的浏览网页的痕迹
      // 持续的跳转
      console.log(history.length) 

    }    
    fn1()
    function myback() {
      history.back()
      // history.go(-1)
    }
    function myforward() {
      history.forward()
      // go(2)
    }
    let mygo = function (num) {
      //前往某个记录
      history.go(num)
    }
 </script>
</body>
</html>